﻿using ctolua.Models.Enum;

namespace ctolua.Models.UI.control
{
    public class MCInput : Mui
    {
        public override EUi type { get => EUi.输入框; set => base.type = EUi.输入框; }

        private bool _focus;
        /// <summary>
        /// 设置输入框焦点 true 获得焦点 false 失去焦点
        /// </summary>
        public bool focus
        {
            get => _focus;
            set
            {
                if (value)
                {
                    game_api.set_input_field_focus(this.role, this.id);
                }
                else
                {
                    game_api.set_input_field_not_focus(this.role, this.id);
                }

                _focus = value;
            }
        }


        /// <summary>
        /// 获得玩家输入框文本内容
        /// </summary>
        public string text => game_api.get_input_field_content(this.role, this.id);


        public MCInput()
        {
        }

        public MCInput(string id) : base(id)
        {
        }

        public MCInput(MCInput u) : base(u)
        {

        }


    }
}
